package it.marco.test.controller;

import org.springframework.validation.MessageCodesResolver;
import org.springframework.web.bind.WebDataBinder;

public class MyDataBinder implements MessageCodesResolver{
	
	protected WebDataBinder dataBinder = null;
	
	public MyDataBinder(WebDataBinder b){
		this.dataBinder = b;
	}
	
	public String[] resolveMessageCodes(String errorCode, String objectName) {
		System.out.println(dataBinder.getBindingResult());
		//System.out.println(dataBinder.getBindingResult().getFieldError(field));
		return null;
		
	}

	public String[] resolveMessageCodes(String errorCode, String objectName,
			String field, Class fieldType) {
		System.out.println(dataBinder.getBindingResult());
		System.out.println(dataBinder.getBindingResult().getFieldError(field));
		return null;
	}
	
}
